<?php
class qMySQLConnection
{
    private $link;
    private $errorcode = '', $error = '';
    
    function __construct($host, $user, $pass)
    {
        // LOG: Connecting as $user@$host: $pass
        $this->link = @mysql_connect($host, $user, $pass);
        
        $this->errorcode = mysql_errno();
        $this->error = mysql_error();
    }
    
    public function Error()
    {
    	if ($this->errorcode == '' && $this->error == '')
    	{
    	    return false;
    	}
    	
    	else
    	{
	    	$this->errorcode = null;
    	  	$errorcode = $this->errorcode;
    	
    		$error = $this->error;
	    	$this->error = null;
    	
    	    return "qMySQLConnection Error: $errorcode: $error";
    	}
    }
    
    public function SelectDatabase($db)
    {
        @mysql_select_db($db, $this->link);
        
		$this->errorcode = mysql_errno();
        $this->error = mysql_error();
    }
}